<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="css/login.css" type="text/css" rel="stylesheet" />
	<title>无标题文档</title>
	<script src="public_js/jquery-1.5.1.min.js"></script>
	<script src="public_js/jquery.form.js"></script>
	
	<script>
		function validate(formData, jqForm, options)
		{
			if (formData[0].value == '')
			{
				alert('用户名不能为空');
				
				return false;
			}
	
			if (formData[1].value == '')
			{
				alert('密码不能为空');
	
				return false;
			}
		}
	
		function succ_func(data)
		{
			if (data != 'success')
			{
				alert('用户名或密码有误');
	
				return false;
			}
			else
			{
				window.location.href = '/admin';
			}
		}
		
		var options = {
			beforeSubmit : validate,
			success : succ_func
		}
		$(document).ready(function(){
	
	        $("#login").submit(function(){
				$(this).ajaxSubmit(options);
	
				return false;
	        });
		});
	</script>
</head>

<body>
	<div class="bg">
		<div class="login">
			<form id="login" action="admin-api_login" method="POST">
				<span>用户名</span><input class="textbox" type="text" value="" name="name" id="name" />
				<span>密&nbsp;&nbsp;码</span><input type="password" class="textbox" value="" name="password" id="password" />
				<input class="submitbtn" type="submit" value="登录" name="" />
			</form>
		</div>
	</div>
</body>
</html>
